<template>
	<view class="container">
		<!-- 位置选择 -->
		<view class="card flex justify-between align-center mb-20" @click="selectLocation">
			<view class="flex align-center">
				<text class="iconfont icon-location" style="color: #007AFF; margin-right: 10rpx;"></text>
				<text>北京</text>
			</view>
			<text class="iconfont icon-down"></text>
		</view>
		
		<!-- 入住时间 -->
		<view class="card flex justify-between mb-20">
			<view class="check-time text-center" style="flex: 1; border-right: 1rpx solid #eee;">
				<text class="block text-gray">入住</text>
				<text class="block mt-10">6月15日</text>
				<text class="block text-gray mt-10">周日</text>
			</view>
			<view class="check-time text-center" style="flex: 1;">
				<text class="block text-gray">离店</text>
				<text class="block mt-10">6月16日</text>
				<text class="block text-gray mt-10">周一</text>
			</view>
		</view>
		
		<!-- 筛选条件 -->
		<view class="card mb-20">
			<view class="flex">
				<view class="filter-item flex align-center" style="flex: 1; justify-content: center; border-right: 1rpx solid #eee;">
					<text>价格</text>
					<text class="iconfont icon-down" style="margin-left: 10rpx;"></text>
				</view>
				<view class="filter-item flex align-center" style="flex: 1; justify-content: center; border-right: 1rpx solid #eee;">
					<text>星级</text>
					<text class="iconfont icon-down" style="margin-left: 10rpx;"></text>
				</view>
				<view class="filter-item flex align-center" style="flex: 1; justify-content: center;">
					<text>筛选</text>
					<text class="iconfont icon-down" style="margin-left: 10rpx;"></text>
				</view>
			</view>
		</view>
		
		<!-- 酒店列表 -->
		<view class="hotel-list">
			<view class="card mb-20" v-for="(item, index) in hotelList" :key="index" @click="goToDetail(item)">
				<view class="flex">
					<image :src="item.image" mode="aspectFill" style="width: 200rpx; height: 150rpx; border-radius: 10rpx;"></image>
					<view style="flex: 1; margin-left: 20rpx;">
						<text class="block" style="font-weight: bold; font-size: 32rpx;">{{ item.title }}</text>
						<view class="flex align-center mt-10">
							<text class="text-red">{{ item.score }}分</text>
							<text class="text-gray ml-10">{{ item.comment }}条评论</text>
						</view>
						<text class="block text-gray mt-10">{{ item.location }}</text>
						<view class="flex justify-between mt-20">
							<text class="text-red" style="font-size: 36rpx;">¥{{ item.price }}</text>
							<text class="button" style="padding: 10rpx 20rpx; font-size: 24rpx;">预订</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				hotelList: [
					{
						id: 1,
						title: '北京王府井大酒店',
						score: 4.8,
						comment: 1280,
						location: '东城区王府井大街',
						price: 680,
						image: '/static/hotel1.jpg'
					},
					{
						id: 2,
						title: '北京国际饭店',
						score: 4.6,
						comment: 960,
						location: '东城区建国门内大街',
						price: 720,
						image: '/static/hotel2.jpg'
					},
					{
						id: 3,
						title: '北京瑰丽酒店',
						score: 4.9,
						comment: 520,
						location: '朝阳区呼家楼京广中心',
						price: 1280,
						image: '/static/hotel3.jpg'
					}
				]
			}
		},
		methods: {
			selectLocation() {
				uni.showToast({
					title: '选择位置功能',
					icon: 'none'
				})
			},
			goToDetail(item) {
				uni.navigateTo({
					url: '/pages/hotel/detail?id=' + item.id
				})
			}
		}
	}
</script>

<style>
	.check-time {
		flex: 1;
	}
	
	.filter-item {
		flex: 1;
		padding: 20rpx 0;
	}
</style>